#include "Transient.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Transient_classType = NULL;
VTable* Transient_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Transient defVal */
Transient* Transient_defVal(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Transient.defVal not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Transient_initType(void)
{
  if (Transient_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Transient_initVTable();
    Type* type = Type_new("Transient", baseType, vtable, sizeof(Transient), sizeof(TransientVTable));
    Type_registerFieldImplementation(type, "defVal", Transient_defVal, NULL);
    Transient_classType = type;
    Transient_initStatic();
  }
  return Transient_classType;
}


VTable* Transient_initVTable(void)
{
  if (Transient_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(TransientVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    Transient_classVTable = vtable;
  }
  return Transient_classVTable;
}


void Transient_initStatic(void)
{
}
